home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr48 / 386p_200.zip / PATTERN.INC < prev    next >
Text File  |  1994-05-24  |  2KB  |  69 lines

  1. ; Tiled background  management routines
  2. ; A "tiled" background is a background image made of rectangular bitmaps
  3. ; This module uses square shaped bitmaps, due to the x/y aspect ratio
  4. ; they are 32x26 pixel wide because of the different aspect ratio
  5. ; ( 4/3 for the monitor, 320/200 for the pixel, and another one for
  6. ;   the maximum image on the monitor)
  7. ;
  8. ; I use to call "patterns" these 32x26 tiles, the reason is that i'm 
  9. ; a native italian that started designing games when at the high school 
  10. ; and never heard the word "tiled background" before reading 
  11. ; it on rec.games.programmer.
  12. ; So, when i reinvented the wheel i had to give it a name :) .
  13.  
  14. ; 1 nudget     = 4  pixel (plane aligned, one pixel for every plane)
  15. ; 1 big nudget = 16 pixel (plane aligned, four nudgets)
  16.  
  17. ; PAT format:
  18. ; 2x26 dwords for each 4 planes.
  19. ; Given a plane, the 52 dwords have to be blitted as follows:
  20. ;         0  1
  21. ;         1  2
  22. ;         3  4
  23. ;        ..  ..
  24. ;        48  49
  25. ;        50  51
  26. ; As you can see a "pattern" is just a "picture" with size 32x26
  27. ; with optimized routines to blit it
  28.  
  29. ; reads pattern from screen
  30. extrn _GetPat:near
  31.         ; in:
  32.         ; edi = pic dest
  33.         ; esi = scr source base
  34.         ; eax = x in nudgets
  35.         ; edx = y in pixels
  36.         ; out:
  37.         ; edi = ptr to end of picture
  38.  
  39. ; Writes a pattern to screen using an unrolled loop
  40. ; (don't worry for the movsd, the cpu-memory interface
  41. ; is stressed to the limit with this and we need "small" opcodes
  42. ; to keep the pipeline filled on 386s
  43. ; The main speed gain is obtained avoiding the loop
  44. ; and thus keeping the pipeline filled even on 386s
  45.  
  46. extrn _PutPat:near
  47.         ; in:
  48.         ; edi = scr dest
  49.         ; esi = pat source 
  50.         ; eax = x in nudgets
  51.         ; edx = y in pixels
  52.         
  53.  
  54. extrn _PutHPat:near
  55.         ; in:
  56.         ; edi = scr dest
  57.         ; esi = pat source 
  58.         ; eax = x in nudgets
  59.         ; edx = y in pixels
  60.         ; same as _PutPat but blits a shriked tile bimap 16*13
  61.         
  62. ; draws a tiled background map
  63. extrn _PutMap:near
  64.         ; in:
  65.         ; esi = map matrix [YTILES][XTILES]
  66.         ; eax = x in pixels
  67.         ; ebx = y in pixels
  68.  
  69.